//
//  DemoLoginManager.h
//  QQMiniGameSDKDemo
//
//  Created by Goyoungs on 2023/4/25.
//  Copyright © 2023 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "QQMiniGameWXLoginTokenModel.h"
#import "QQMiniGameLoginDefine.h"

@protocol WXApiDelegate;

NS_ASSUME_NONNULL_BEGIN

@interface QQMiniGameLoginManager : NSObject

/// 当前登录类型
@property (nonatomic, readonly) QQMiniGameLoginType loginType;

+ (QQMiniGameLoginManager *)sharedInstance;

/// 注册qq互联应用ID
/// - Parameters:
///   - qqAppID: qq互联应用appID
///   - universalLink: universalLink
- (void)registerQQAppID:(NSString *)qqAppID
          universalLink:(NSString *)universalLink;

/// 注册微信互联应用ID
/// - Parameters:
///   - wxAppID: 微信应用appID
///   - universalLink: univeralLlink
///   - secretKey:微信应用secretKey，用于登录sdk内部处理token请求的参数。宿主自行实现token请求时，可传空
///   - delegate: 宿主处理微信token请求delegate，传空则由登录sdk处理token请求。建议宿主实现token请求
- (void)registerWXAppID:(NSString *)wxAppID
          universalLink:(NSString *)universalLink
              secretKey:(nullable NSString *)secretKey
               delegate:(nullable id<QQMiniGameWXLoginDelegate>)delegate;

/// 登录接口
/// - Parameters:
///   - vc: 当前vc
///   - complete: 登录结果回调
- (void)login:(UIViewController *_Nullable)vc
     complete:(QQMiniGameLoginComplete)complete;

/// 退出登录接口
/// - Parameter complete: 退出登录结果回调
- (void)logout:(QQMiniGameLogoutComplete)complete;

/// 当前登录类型的openID
- (NSString *)openID;

/// 当前登录类型的token
- (NSString *)accessToken;

/// 当前登录类型的appID
- (NSString *)appID;

#pragma mark - handleOpenUrl 回调

/// 处理wx登录回调
- (id<WXApiDelegate>)handleWxUrlDelegate;

@end

NS_ASSUME_NONNULL_END
